home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 18 / CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso / CUCD / Online / hsc / docs-source / features / spcattr.hsc < prev    next >
Encoding:
Text File  |  1997-10-10  |  13.8 KB  |  356 lines

  1. <WEBPAGE chapter="hsc - Features - " title="Special Attributes"
  2.     PREV="getsize.html"
  3.     NEXT="strip.html">
  4.  
  5. <P><hsc CAP> adds some special attributes, which can be quite useful to
  6. include special data or configure the parser.</P>
  7.  
  8. <UL>
  9. <LI><A HREF="#anchor"><CODE>Hsc.Anchor</CODE></A> - destination URI of last anchor
  10. <LI><A HREF="#clickhere"><CODE>Hsc.Click-Here</CODE></A> - keywords for "click here"-syndrome
  11. <LI><A HREF="#colornames"><CODE>Hsc.Color-Names</CODE></A> - values to be used as colors-names
  12. <LI><A HREF="#colornames"><CODE>Hsc.Content</CODE></A> - content text of current container macro
  13. <LI><A HREF="#documentattr"><CODE>Hsc.Document.Name</CODE></A> - filename of html-object
  14. <LI><A HREF="#documentattr"><CODE>Hsc.Document.Path</CODE></A> - directory part of html-object
  15. <LI><A HREF="#documentattr"><CODE>Hsc.Document.URI</CODE></A> - full relative URI of html-object
  16. <LI><A HREF="#exec.result"><CODE>Hsc.Exec.Result</CODE></A> - return-code of command invoked by <ln_exec>
  17. <LI><A HREF="#lf"><CODE>Hsc.LF</CODE></A> - a single linefeed-character
  18. <LI><A HREF="#sourceattr"><CODE>Hsc.Source.Name</CODE></A> - filename of hsc-source
  19. <LI><A HREF="#sourceattr"><CODE>Hsc.Source.Path</CODE></A> - directory part of hsc-source
  20. <LI><A HREF="#sourceattr"><CODE>Hsc.Source.File</CODE></A> - full path and filename of hsc-source
  21. <LI><A HREF="#system"><CODE>Hsc.System</CODE></A> - value depending on operating system
  22. <LI><A HREF="#format.filesize"><CODE>Hsc.Format.Filesize</CODE></A> - how to render <ln_getfilesize>
  23. <LI><A HREF="#format.time"><CODE>Hsc.Format.Time</CODE></A> - how to render <ln_gettime> and <ln_getgmtime>
  24. <LI><A HREF="#tmp"><CODE>Hsc.TMP.*</CODE></A> - temporary attributes for internal use
  25. </UL>
  26.  
  27. <* insert heading for another special attribute *>
  28. <$macro SPCATTR NAME:string/r TITLE:string/r>
  29. <H3><A NAME=(name)><(title)></A></H3>
  30. </$macro>
  31.  
  32. <H2>Attributes Containing Special Data</H2>
  33.  
  34. <**********************************************************>
  35. <* Hsc.Anchor                                             *>
  36. <**********************************************************>
  37. <SPCATTR NAME="anchor" TITLE="Hsc.Anchor">
  38.  
  39. <P>This attribute is defined internally during startup and is maintained
  40. by <hsc>. It contains the URI of the last anchor referenced to.</P>
  41.  
  42. <STRONG>Example:</STRONG>
  43.  
  44. <$include FILE="exmpl/anchor.hsc" SOURCE PRE>
  45.  
  46. will be converted to:
  47. <BLOCKQUOTE>
  48. <$include FILE="exmpl/anchor.hsc">
  49. </BLOCKQUOTE>
  50.  
  51. <**********************************************************>
  52. <* Hsc.Content                                            *>
  53. <**********************************************************>
  54. <SPCATTR NAME="content" TITLE="Hsc.Content">
  55.  
  56. <P>This attribute is defined internally during startup and is
  57. maintained by <hsc>. It contains the the text which will be inserted
  58. if a <TG>$content</TG> shows up, and is updated at every call to a
  59. container macro.
  60.  
  61. <**********************************************************>
  62. <* Hsc.Document                                           *>
  63. <**********************************************************>
  64. <SPCATTR NAME="documentattr" TITLE=" Hsc.Document.Name, Hsc.Document.Path, Hsc.Document.URI">
  65.  
  66. <P>These attributes are defined internally during startup and are read-only.
  67. They contain the filename, the directory and the whole
  68. relative URI of the to be created html-object.</P>
  69.  
  70. For example,
  71. <$source PRE>
  72.     hsc FROM people/hugo.hsc TO html:my_project/
  73. </$source>
  74. will lead to
  75.  
  76. <*<$source PRE>
  77.     attribute         | value
  78.     ------------------+----------------
  79.     Hsc.Document.Name | "hugo.html"
  80.     Hsc.Document.Path | "people/"
  81.     Hsc.Document.URI  | "people/hugo.html"
  82. </$source>*>
  83.  
  84. <TABLE BORDER="1">
  85. <TR>
  86. <TH>attribute</TH>
  87. <TH>value</TH>
  88. </TR>
  89. <TR>
  90. <TD>Hsc.Document.Name</TD>
  91. <TD>"hugo.html"</TD>
  92. </TR>
  93. <TR>
  94. <TD>Hsc.Document.Path</TD>
  95. <TD>"people/"</TD>
  96. </TR>
  97. <TR>
  98. <TD>Hsc.Document.URI</TD>
  99. <TD>"people/hugo.html"</TD>
  100. </TR>
  101. </TABLE>
  102.  
  103. Note that <CODE>Hsc.Document.Path</CODE> does not contain the whole
  104. destination directory, but only the relative path.
  105.  
  106. <SPCATTR NAME="exec.result" TITLE="Hsc.Exec.Result">
  107.  
  108. This attribute contains the return-code of the command invoked 
  109. using <ln_exec>. It is updated after every call of this hsc-tag.
  110.  
  111. <**********************************************************>
  112. <* Hsc.LF                                                 *>
  113. <**********************************************************>
  114. <SPCATTR NAME="lf" TITLE="Hsc.LF">
  115.  
  116. This attribute contains a single linefeed-character
  117. (<qq><CODE>\n</CODE></qq>) and can be used to include linefeeds into
  118. attribute-values without <hsc> whining about them.
  119.  
  120. <**********************************************************>
  121. <* Hsc.Source...                                          *>
  122. <**********************************************************>
  123. <SPCATTR NAME="sourceattr" TITLE="Hsc.Source.Name, Hsc.Source.Path, Hsc.Source.File">
  124.  
  125. <P>These attributes are defined internally during startup and are
  126. read-only. They contain the filename, the directory and the full path
  127. and filename of the hsc-source you have specified when invoking
  128. <hsc>.</P>
  129.  
  130. For example,
  131.  
  132. <$source PRE>hsc FROM people/hugo.hsc TO html:my_project/</$source>
  133.  
  134. will lead to
  135.  
  136. <*<$source PRE>
  137.     attribute       | value
  138.     ----------------+----------------
  139.     Hsc.Source.Name | "hugo.hsc"
  140.     Hsc.Source.Path | "people/"
  141.     Hsc.Source.File | "people/hugo.hsc"
  142. </$source>*>
  143.  
  144. <TABLE BORDER="1">
  145. <TR>
  146. <TH>attribute</TH>
  147. <TH>value</TH>
  148. </TR>
  149. <TR>
  150. <TD>Hsc.Source.Name</TD>
  151. <TD>"hugo.hsc"</TD>
  152. </TR>
  153. <TR>
  154. <TD>Hsc.Source.Path</TD>
  155. <TD>"people/"</TD>
  156. </TR>
  157. <TR>
  158. <TD>Hsc.Source.File</TD>
  159. <TD>"people/hugo.hsc"</TD>
  160. </TR>
  161. </TABLE>
  162.  
  163. <**********************************************************>
  164. <* Hsc.System                                             *>
  165. <**********************************************************>
  166. <SPCATTR NAME="system" TITLE="Hsc.System">
  167.  
  168. <P>This attribute is defined internally during startup and is
  169. read-only. It contains a value depending on the operating
  170. system <hsc> is running on.</P>
  171.  
  172. <*<PRE>
  173.     OS      | Hsc.System
  174.     --------+-----------
  175.     AmigaOS | AMIGA
  176.     RiscOS  | RISCOS
  177.     Unixoid | UNIX
  178. </PRE>*>
  179.  
  180. <TABLE BORDER="1">
  181. <TR>
  182. <TH>OS</TH>
  183. <TH><CODE>Hsc.System</CODE></TH>
  184. </TR>
  185. <TR>
  186. <TD>AmigaOS</TD>
  187. <TD>AMIGA</TD>
  188. </TR>
  189. <TR>
  190. <TD>RiscOS</TD>
  191. <TD>RISCOS</TD>
  192. </TR>
  193. <TR>
  194. <TD>BeOS</TD>
  195. <TD>BEOS</TD>
  196. </TR>
  197. <TR>
  198. <TD>NextStep</TD>
  199. <TD>NEXTSTEP</TD>
  200. </TR>
  201. <TR>
  202. <TD>Unixoid</TD>
  203. <TD>UNIX</TD>
  204. </TR>
  205. </TABLE>
  206.  
  207. This can be useful if you are executing a shell-command during
  208. conversion. See <ln_exec> for an example how to include a
  209. listing of the current directory, working with more then only
  210. a specific OS.
  211.  
  212. <**********************************************************>
  213. <* Hsc.TMP...                                             *>
  214. <**********************************************************>
  215. <SPCATTR NAME="tmp" TITLE="Hsc.TMP.*">
  216.  
  217. <P>For several tasks, <hsc> declares it's own temporary attributes for
  218. internal use. Most of them you can not use inside your own
  219. expressions. The only reason why I list them here is, that some of
  220. them might show up in messages.</P>
  221.  
  222. <P>For example, if you are using the special tag <A
  223. HREF="spctags.html#expression"><(...)></A> (insert expression),
  224. <hsc> creates an attribute <CODE>Hsc.TMP.insert.expression</CODE> to
  225. assign the value of the expression you passed between the brackets. If
  226. this expression contains errors, you will achieve a message mentioning
  227. the attribute <CODE>Hsc.TMP.insert.expression</CODE>.</P>
  228.  
  229. <H2>Attributes for configuration</H2>
  230.  
  231. <**********************************************************>
  232. <* Hsc.Color-Names                                        *>
  233. <**********************************************************>
  234.  
  235. <SPCATTR NAME="colornames" TITLE="Hsc.Color-Names">
  236.  
  237. <P>This attribute is defined in <hsc.prefs> and can be altered to the
  238. user's needs. However, it's value is scanned only once (immediately
  239. after processing <hsc.prefs> and later changes will not be recognised
  240. by <hsc>.</P>
  241.  
  242. <P>For attributes of type 
  243. <A HREF=":macro/attrib.html#type"><CODE>COLOR</CODE></A>, 
  244. you can not only use the
  245. cryptic <CODE>#rrggbb</CODE>-style, but also use some predefined
  246. values. With this attribute you can declare which values <hsc> should
  247. know about, each separated by a <vbar>.</P>
  248.  
  249. <STRONG>Example:</STRONG>
  250. <$source><$define Hsc.Color-Names:string/c="aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow"></$source>
  251.  
  252. <P>This one contains all values recommended for html-0.32 and is in
  253. the <hsc.prefs> that came with this distribution.</P>
  254.  
  255. <**********************************************************>
  256. <* Hsc.Click-Here                                         *>
  257. <**********************************************************>
  258. <SPCATTR NAME="clickhere" TITLE="Hsc.Click-Here">
  259. <P>This attribute is defined in <hsc.prefs> and can be altered to the
  260. user's needs. However, it's value is only scanned once and later
  261. changes will not be recognised by <hsc>.</P>
  262.  
  263. Inside an anchor tag (<TG>A HREF="..."</TG>), the normal text is
  264. scanned for special keywords indicating a <qq>click here</qq>-syndrome.
  265. With this attribute you can declare these keywords,
  266. each separated by a <vbar>.
  267.  
  268. <STRONG>Example:</STRONG>
  269. <$source PRE><$define Hsc.Click-Here:string/c="click|here"></$source>
  270.  
  271. <P>When processing German documents, probably this one would
  272. fit better:</P>
  273. <$source PRE><$define Hsc.Click-Here:string/c="klicken|hier"></$source>
  274.  
  275. <**********************************************************>
  276. <* Hsc.Format.filesize                                    *>
  277. <**********************************************************>
  278. <SPCATTR NAME="format.filesize" TITLE="Hsc.Format.Filesize">
  279.  
  280. This attribute contains a template that descibes how the result
  281. of <ln_getfilesize> should be rendered. Conversion specifications:
  282.  
  283. <PRE>
  284.     <STRONG>%b</STRONG>    is replaced by the filesize in bytes.
  285.     <STRONG>%k</STRONG>    is replaced by the filesize in kilo-bytes.
  286.     <STRONG>%m</STRONG>    is replaced by the filesize in mega-bytes.
  287.     <STRONG>%g</STRONG>    is replaced by the filesize in giga-bytes.
  288.     <STRONG>%a</STRONG>    is replaced by the filesize, with a reasonable unit computed automatically
  289.     <STRONG>%u</STRONG>    is replaced by the unit for <STRONG>%a</STRONG>
  290. </PRE>
  291. This attribute is defined internally during startup, and contains the
  292. value <CODE>"%a%u"</CODE>, leading to results like <CODE>"123K"</CODE> or
  293. <CODE>"12M"</CODE>. It can be changed by the user at any time.
  294.  
  295. <**********************************************************>
  296. <* Hsc.Format.Time                                        *>
  297. <**********************************************************>
  298. <SPCATTR NAME="format.time" TITLE="Hsc.Format.Time">
  299.  
  300. This attribute contains a template that describes how the result
  301. of <ln_gettime> and <ln_getgmtime> should be rendered. 
  302. Conversion specifications 
  303. (Techn. Note: These are the same as for ANSI-C's <CODE>strftime()</CODE>):
  304. <PRE>
  305.     <STRONG>%A</STRONG>    is replaced by the full weekday name.
  306.     <STRONG>%a</STRONG>    is replaced by the abbreviated weekday name, where the abbreviation
  307.            is the first three characters.
  308.     <STRONG>%B</STRONG>    is replaced by the full month name.
  309.     <STRONG>%b or %h</STRONG>
  310.            is replaced by the abbreviated month name, where the abbreviation
  311.            is the first three characters.
  312.     <STRONG>%C</STRONG>    is equivalent to <qq>%a %b %e %H:%M:%S %Y</qq>
  313.     <STRONG>%c</STRONG>    is equivalent to <qq>%m/%d/%y</qq>.
  314.     <STRONG>%D</STRONG>    is replaced by the date in the format <qq>mm/dd/yy</qq>.
  315.     <STRONG>%d</STRONG>    is replaced by the day of the month as a decimal number (01­31).
  316.     <STRONG>%e</STRONG>    is replaced by the day of month as a decimal number (1­31); single
  317.            digits are preceded by a blank.
  318.     <STRONG>%H</STRONG>    is replaced by the hour (24­hour clock) as a decimal number
  319.            (00­23).
  320.     <STRONG>%I</STRONG>    is replaced by the hour (12­hour clock) as a decimal number
  321.            (01­12).
  322.     <STRONG>%j</STRONG>    is replaced by the day of the year as a decimal number (001­366).
  323.     <STRONG>%k</STRONG>    is replaced by the hour (24­hour clock) as a decimal number (0­23);
  324.            single digits are preceded by a blank.
  325.     <STRONG>%l</STRONG>    is replaced by the hour (12­hour clock) as a decimal number (1­12);
  326.            single digits are preceded by a blank.
  327.     <STRONG>%M</STRONG>    is replaced by the minute as a decimal number (00­59).
  328.     <STRONG>%m</STRONG>    is replaced by the month as a decimal number (01­12).
  329.     <STRONG>%n</STRONG>    is replaced by a newline.
  330.     <STRONG>%p</STRONG>    is replaced by either <qq>AM</qq> or <qq>PM</qq> as appropriate.
  331.     <STRONG>%R</STRONG>    is equivalent to <qq>%H:%M</qq>
  332.     <STRONG>%r</STRONG>    is equivalent to <qq>%I:%M:%S %p</qq>.
  333.     <STRONG>%t</STRONG>    is replaced by a tab.
  334.     <STRONG>%S</STRONG>    is replaced by the second as a decimal number (00­60).
  335.     <STRONG>%s</STRONG>    is replaced by the number of seconds since the Epoch, UCT.
  336.     <STRONG>%T or %X</STRONG>    
  337.            is equivalent to <qq>%H:%M:%S</qq>.
  338.     <STRONG>%U</STRONG>    is replaced by the week number of the year (Sunday as the first day
  339.            of the week) as a decimal number (00­53).
  340.     <STRONG>%W</STRONG>    is replaced by the week number of the year (Monday as the first day
  341.            of the week) as a decimal number (00­53).
  342.     <STRONG>%w</STRONG>    is replaced by the weekday (Sunday as the first day of the week) as
  343.            a decimal number (0­6).
  344.     <STRONG>%x</STRONG>    is equivalent to <qq>%m/%d/%y %H:%M:%S</qq>.
  345.     <STRONG>%Y</STRONG>    is replaced by the year with century as a decimal number.
  346.     <STRONG>%y</STRONG>    is replaced by the year without century as a decimal number
  347.            (00­99).
  348.     <STRONG>%Z</STRONG>    is replaced by the time zone name.
  349.     <STRONG>%%</STRONG>    is replaced by <qq>%</qq>.
  350. </PRE>
  351. This attribute is defined internally during startup, and contains the
  352. value <qqc>%d-%b-%Y, %H:%M</qqc>, leading to results like
  353. <CODE>"<(GetTime())></CODE>".
  354. <BR>
  355. </WEBPAGE>
  356.